home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Development / General / ViewIt™ 2.24 Shareware / Pascal Demo Projects / Metrowerks Pascal 1.0d7 Demos / vDemoMP.p < prev    next >
Text File  |  1994-03-02  |  4KB  |  133 lines

  1. {ViewIt 2.2 Demonstration Program}
  2. {©FaceWare 1991-94.  All Rights Reserved.}
  3.  
  4. program vDemoMP;
  5.  
  6.     uses
  7.         FaceStorMP, FaceProcMP;
  8.  
  9.     var
  10.         helpShown: boolean;
  11.         myRec: record
  12.                 myInteger: integer;
  13.                 myReal: real;
  14.                 myString: string[99];
  15.                 myFlags: longint;
  16.             end;
  17.         myList: integer;
  18.         oldTicks, newTicks: longint;
  19.         theReal, delta: real;
  20.  
  21.     procedure JumpIt (thePtr: Ptr);
  22.     inline
  23.         $2257, $2051, $4E90;
  24.  
  25.     procedure OverProc (thePtr: Ptr);
  26.     begin
  27.         with fRec do
  28.             if (uCommand = 264) then        {a key down message?}
  29.                 if (uParam[1] = 32) then    {SPACE key pressed?}
  30.                     uParam[1] := 95;            {convert to UNDERLINE}
  31.         JumpIt(thePtr);                        {pass message to driver}
  32.     end;
  33.  
  34. begin
  35.     myRec.myInteger := 0;
  36.     myRec.myReal := 6.2;
  37.     myRec.myString := 'Hello';
  38.     myRec.myFlags := 10;
  39.     myList := 2;
  40.     oldTicks := 0;
  41.     theReal := 6.0;
  42.  
  43. {Initialize FaceIt}
  44.     fRec.uName := 'vDemo.Rsrc';
  45.     FaceIt(nil, DoInit, 0, 0, 0, 0);
  46.  
  47. {Open Modeless Window using FWND 1000}
  48.     FaceIt(nil, NewWnd, 1000, 1, 0, 0);
  49.  
  50.     with fRec do
  51.         repeat
  52.             FaceIt(nil, DoLoop, 0, 0, 0, 0);
  53. {Standard "About" Menu Item Selection}
  54.             if (uMenuID = 101) and (uMenuItem = 1) then
  55.                 begin
  56.                     uString := concat('Demonstration of the use of ViewIt', chr(13), 'windows in a FaceIt-based program.');
  57.                     FaceIt(nil, ShoStr, 3, 12, 1 + (409 * 65536), 0);
  58.                 end
  59. {Hit in Modeless Window's "Open Modal" Button}
  60.             else if (uMenuID = 1000) and (wcHit = 2) then
  61.                 begin
  62.                     FaceIt(nil, NewWnd, 1001, 0, 0, 0);        {Open Modal Window}
  63.                     repeat
  64.                         FaceIt(nil, MdlWnd, 1001, 0, 0, 0);    {Process Modal Events}
  65.                         if (wcHit = -1) then                            {Hit in Close Box}
  66.                             leave
  67.                         else if (wcHit = 1) then                        {Hit in "Open Nested" Button}
  68.                             begin                                                    {Open Nested Modal}
  69.                                 FaceIt(nil, NewWnd, 1002, 0, 110, ord(@myRec));
  70.                                 FaceIt(nil, GetCtl, 1002, 0, 3, 3);            {Link Scrollable List}
  71.                                 FaceIt(nil, LnkCtl, ord(cControl), ord(@myList), 2, 0);
  72.                                 FaceIt(nil, GetCtl, 1002, 0, 2, 3);            {Set Override Proc}
  73.                                 FaceIt(nil, OvrCtl, ord(cControl), ord(@OverProc), 0, 0);
  74.                                 FaceIt(nil, SetVal, 1002, 0, 0, 0);        {Set Linked Values}
  75.                                 helpShown := false;
  76.                                 repeat
  77.                                     FaceIt(nil, MdlWnd, 1002, -2, 0, 0);        {Process Modal Events}
  78.                                     if (uMenuID = 0) then                                {No Message}
  79.                                         begin
  80.                                             newTicks := TickCount;
  81.                                             if (newTicks > oldTicks + 60) then
  82.                                                 begin
  83.                                                     oldTicks := newTicks;
  84.                                                     FaceIt(nil, GetCtl, 1002, 0, 2, 8);
  85.                                                     SetCtlValue(cControl, (cValue mod 4) + 1);
  86.                                                 end;
  87.                                         end
  88.                                     else if (wvHit = 1) then                            {Hit in View #1}
  89.                                         begin
  90.                                             if (wcHit = 1) then                        {Hit in "OK" Button}
  91.                                                 leave
  92.                                             else if (wcHit = 2) then                    {Hit in "Show/Hide" Button}
  93.                                                 if helpShown then
  94.                                                     begin
  95.                                                         FaceIt(nil, ShoCtl, 0, 0, -3, 2);        {Hide v3, Show v2}
  96.                                                         helpShown := false;
  97.                                                     end
  98.                                                 else
  99.                                                     begin
  100.                                                         FaceIt(nil, ShoCtl, 0, 0, -2, 3);        {Hide v2, Show v3}
  101.                                                         helpShown := true;
  102.                                                     end;
  103.                                         end
  104.                                     else if (wvHit = 2) then                            {Hit in View #2}
  105.                                         if (wcHit = 6) or (wcHit = 7) then        {Hit in Up/Down Arrow}
  106.                                             begin
  107.                                                 FaceIt(nil, GetCtl, 1002, 0, 2, wcHit);
  108.                                                 delta := 0.001 * (cMin - 2);
  109.                                                 myRec.myReal := myRec.myReal + delta;
  110.                                                 FaceIt(nil, SetVal, 1002, 0, 2, 2);
  111.                                                 Delay(5, uI4);
  112.                                             end;
  113.                                 until false;
  114.                                 FaceIt(nil, GetVal, 1002, 0, 0, 0);    {Get Linked Values}
  115.                                 FaceIt(nil, EndWnd, 1002, 0, 0, 0);    {Close Nested Modal}
  116.                             end;
  117.                     until false;
  118.                     FaceIt(nil, EndWnd, 1001, 0, 0, 0);        {Close Modal Window}
  119.                 end
  120. {Hit in Modeless Window's "Why ViewIt?" Button}
  121.             else if (uMenuID = 1000) and (wcHit = 3) then
  122.                 begin
  123.                     FaceIt(nil, NewWnd, 1003, 0, 0, ord(@theReal));
  124.                     FaceIt(nil, SetVal, 1003, 0, 0, 0);
  125.                     repeat
  126.                         FaceIt(nil, MdlWnd, 1003, 0, 0, 0);
  127.                     until (wcHit = 1);
  128.                     FaceIt(nil, GetVal, 1003, 0, 0, 0);
  129.                     FaceIt(nil, EndWnd, 1003, 0, 0, 0);
  130.                 end;
  131.         until false;
  132.  
  133. end.